<?php 
session_start();
require_once('wxbrower.php');
require_once("../includes/public.inc.php");
//require_once("../includes/conn.php");
$s = isset($_GET['s'])?$_GET['s']:'';
$openid = isset($_GET['openid'])?$_GET['openid']:'';
$type = isset($_GET['type'])?$_GET['type']:'hy';
$action = isset($_GET['act'])?$_GET['act']:'';
if($action == "logout")
{	
	session_destroy();
	die("<script>parent.location.href = 'login.php?type=".$type."';</script>");
}
if($type){
	if ($openid)
	{
		if ($type=="dg")
		{
			$exsit_openid = mysql_fetch_array(mysql_query("select * from ".DBQIAN."daogou where openid='".$openid."' and status=1 order by id desc limit 1"));
		}
		else 
		{
			$exsit_openid = mysql_fetch_array(mysql_query("select * from ".DBQIAN."users where openid='".$openid."' order by id desc limit 1"));
		}
		if ($exsit_openid)
		{
			$_SESSION['openid'] = $openid;
			if ($type=='dg')
			{
			 	header("Location: linghongbao.php?s=".$s."&openid=".$openid);exit;
			}
			else 
			{
				header("Location: jifen.php?s=".$s."&openid=".$openid);exit;
			}
		}
	}
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<meta name="viewport" content="user-scalable=yes, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title><?if ($type=='dg'){?>导购<?}else{?>用户<? }?>登陆</title>
<link rel="stylesheet" type="text/css" href="css/index.css" media="all">
<script src="js/jquery.min.js"></script>
<script>
	$(function(){
		$('#submit').click(function(){
			if (!$('#userID').val())
			{
				alert("请输入用户名！");return false;
			}
			if (!$('#userPWD').val())
			{
				alert("请输入登录密码！如果忘记请联系管理员！");return false;
			}
		});
	});
</script>
</head>
<body>
<div class="pz-css">
	<ul class="top-tool">
		<li class="title"><?if ($type=='dg'){?>导购<?}else{?>用户<? }?>登陆</li>
		<li class="back"><a href="javascript:history.go(-1)"></a>
		</li><li class="home"><a href="index.php"></a></li>
	</ul>
      <form id="form1" name="login" method="post" action="login_enter.php?act=login&type=<?=$type?>&s=<?=$s?>">
		<div class="pz-panel">
			<h4>温馨提示：</h4>
				<h5>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;尊敬的用户，您好！欢迎注册会员，可享受商家相关优惠、积分送礼等，马上行动吧，海量优惠等着您！</h5>
		</div>
		<div class="pz-panel" style="background-color: rgb(255, 255, 255);">
			<table class="list" border="0" cellspacing="0" width="100%">
			<tbody><tr>
				<td style="width: 90px;">手机号码：</td>
				<td align="left"><span class="span12"><input value="" maxlength="20" id="userID" name="user" type="text" /></span></td>
			</tr>
			<tr>
				<td>输入密码：</td>
				<td align="left"><span class="span12"><input maxlength="20" value="" id="userPWD" name="password" type="password" /></span></td>
			</tr>
        <input value="1" maxlength="20" id="userID" name="su" type="hidden" />
         <input value="<?=$s?>" maxlength="20" id="userID" name="s" type="hidden" />
			</tbody></table>
		</div>
		<div class="group">
			<div class="span6"><button type="button" onclick="location.href='selectregister.php?s=<?=$s?>'">免费注册</button></div>
            <div class="span6"><button type="submit" class="red" name="submit" id="submit" ><?if ($type=='dg'){?>导购<?}else{?>用户<? }?>登录</button></div>
            
		</div>
       
	</form>
</div>

</body>
</html>
<?php }else{?>
<?php 
	echo "<script>parent.location.href='login.php?type=hy';</script>";exit;
}?>

